Nth positive number whose absolute difference of adjacent digits is at most 1
Given a number N, the task is to find the Nth number which has an absolute difference of 1 between every pair of its adjacent digits.Examples:...
read more
All reverse permutations of an array using STL in C++
Given an array, the task is to print or display all the reverse permutations of this array using STL in C++. Reverse permutation means, for an array {1, 2, 3}:...
read more
Find Unique ID and Domain Name of a Website from a string
Given a string S of size N consisting of unique ID and Domain Name of a unique website, the task is to find the ID and the Domain Name in the given string if the ID is of the form [char, char, char, char, char, digit, digit, digit, digit, char]....
read more
C++ Program to Find closest number in array
Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers....
read more
How to implement text Auto-complete feature using Ternary Search Tree
Given a set of strings S and a string patt the task is to autocomplete the string patt to strings from S that have patt as a prefix, using a Ternary Search Tree. If no string matches the given prefix, print “None”.Examples:...
read more
Check if a given number is a Perfect square using Binary Search
Check if a given number N is a perfect square or not. If yes then return the number of which it is a perfect square, Else print -1....
read more
Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
Prerequisites: Segment TreeGiven a number N which represents the size of the array initialized to 0 and Q queries to process where there are two types of queries:...
read more
Frequency of an integer in the given array using Divide and Conquer
Given an unsorted array arr[] and an integer K, the task is to count the occurrences of K in the given array using the Divide and Conquer method....
read more
What is the difference between Set vs Hashset in C++?
In C++, both set and HashSet(also called unordered_set) are used to store elements but they have different properties and use cases. In this article, we will learn the key differences between a set and a HashSet in C++....
read more
How to Create Deque of Unordered_Set in C++?
In C++, a deque (double-ended queue) is a container that allows insertion and removal of elements from both ends whereas an unordered set is a container that stores unique elements in no particular order. In this article, we will learn how to create a deque of unordered sets in C++ STL....
read more
Ternary number system or Base 3 numbers
A number system can be considered as a mathematical notation of numbers using a set of digits or symbols. In simpler words, the number system is a method of representing numbers. Every number system is identified with the help of its base or radix....
read more
StringStream in C++ for Decimal to Hexadecimal and back
Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to number/char etc. Hex is an I/O manipulator that takes reference to an I/O stream as parameter and returns reference to the stream after manipulation. Here is a quick way to convert any decimal to hexadecimal using stringstream:...
read more